<?php if (!defined('THINK_PATH')) exit(); /*a:3:{s:44:"D:\web\quan/app/index\view\member\index.html";i:1537492950;s:45:"D:\web\quan/app/index\view\member\bottom.html";i:1537432626;s:45:"D:\web\quan/app/index\view\public\footer.html";i:1537432627;}*/ ?>
<!DOCTYPE html> 
<html>

	<head>
		<meta charset="UTF-8">
		<title>个人中心</title>
		<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />  
	    <script src="__INDEX__/js/mui.min.js"></script>
 
	    <link rel="stylesheet" href="__PUBLIC__/static/wx/style/iconfont.css" />
	    <link rel="stylesheet" href="__PUBLIC__/static/wx/style/new.css?1=1" />
	    <link rel="stylesheet" href="__PUBLIC__/static/wx/style/style.css" />
	    <style>
	    	.tuig_list li{
	    		    padding: 22px 25px 20px 10px;
	    		    border-radius: 5px;
	    	}
	    	.tuig_list li em {
			    font-size: 1.2rem;
			    font-weight: bold;
			}
			.tuig_box {

			    padding-top: 24%;
			}
			.mem_nav li .nam{
				padding-top: .7rem;
			}
			/*绑定弹出框*/
		.mask{background: rgba(0,0,0,0.7); width: 100%; height: 100%; position: fixed; left: 0; top: 0; display: none;}
		.phone_box{width: 80%; background: white; margin: 9rem auto 0; border-radius: 3px; padding: 4% 5% 5%;}
		.phonetc_bt{color: #000000; font-weight: bold; font-size: 1rem; margin-bottom: .1rem;}
		.phone_box .wz{font-size: .85rem; line-height: normal; margin-bottom: 1.2rem; color: #666666;}
		.phone_box input{border-color: #811588; padding: 10px; color: #000000; font-size: .85rem;}
		.phone_btn{background: #38ab3c; border: 0; width: 100%; height: 2.5rem; color: white; font-size: 1.1rem; margin-top: .5rem;}
		.phone_box .yzm_input{width: 52%; float: left;}
		.yzm_btn{width: 45%; float: right; background: #CCCCCC; text-align: center; font-size: .85rem; height: 40px; line-height: 40px; border-radius: 5px; color: #000000;}
		.phone_box input{    line-height: 21px;
		    width: 100%;
		    height: 40px;
		    margin-bottom: 15px;
		    padding: 10px 15px;
		    -webkit-user-select: text;
		    border: 1px solid rgba(0,0,0,.2);
		    border-radius: 3px;
		    outline: 0;
		    background-color: #fff;
		    -webkit-appearance: none;
		}
	    </style>
	</head>

	<body style="background-color: #FFFFFF;">
		<header class="header"> 
			<h1 class="mui-title">会员中心</h1>
		</header>
		
		<div class="mui-content"  style="padding-top:44px;">
			<div class="tuig_top">
				<div class="tuig_toux mem_infobox">
					<?php if($info_user['logo'] == null): ?>
		    		<img id="touxiang" src="__INDEX__/images/member.jpg">
		    		<?php else: ?>
		    		<img id="touxiang" src="<?php echo $info_user['logo']; ?>">
		    		<?php endif; ?>
				</div>
				<div class="tuig_nambox">
					<div class="tuig_nam"><?php echo $info_user['user_name']; ?></div>
					<div class="tuig_glj">ID:<?php echo $info_user['id']; ?></div>
					<div class="tuig_glj">推荐上级ID:<?php echo $info_user['level']; ?></div>
				</div>
			</div>
			<div class="tuig_box">
				<ul class="tuig_list clearfix">
					<li id="yu">
						<div class="num"><em>钱包</em></div>
						<div class="qian">￥<span><?php echo $info_user['balance']; ?></span></div>
					</li>
					<li class="right" id="jf">
						<div class="num"><em>鼓励金</em></div>
						<div class="qian">￥<span><?php echo $info_user['score']; ?></span></div>
					</li>
				</ul> 
			</div>
			<ul class="mem_nav clearfix">
				<li >
					<a href="<?php echo url('member/card'); ?>">
						<span class="iconfont icon-erweima"></span>
						<div class="nam">分享码</div>
					</a>
				</li>
				<input type="hidden" id="fx" value="<?php echo $info_user['is_fx']; ?>">
				<li id="tui"> 
					<a href="#"> 
						<span class="iconfont icon-gerenzhongxin"></span>
						<div class="nam">我的好友</div>
					</a>
				</li>
				
				<li >
					<a href="<?php echo url('index/member/edit'); ?>">
						<span><img style="width: 1.63rem;height: 1.63rem;" src="/public/static/wx/images/sz.png"</span>
						<div class="nam">设置</div>
					</a>
				</li>
				<li>
					<a href="<?php echo url('index/member/agentsq'); ?>">
						<span class="iconfont icon-shop"></span>
						<div class="nam">服务协议</div>
					</a>
				</li>
			</ul> 
		</div> 
		<?php if($is_atten== false): ?>
			<!--二维码关注弹出框-->
		    <div class="mask gzgzh_mask" style="top:10%;background: rgba(51, 32, 32, 0.6);display: block;">
				<div class="gzgzh"><img src="__INDEX__/images/gzherweima.png"></div>
				<div class="close"><img src="__INDEX__/images/close2.png" onclick="javascript:$('.mask').hide()"></div>
			</div>
		<?php endif; ?>
	<div class="mask" id="bind_phone" style="display: block;">
			<form id='login-form' class="login_formbox">
			<div class="phone_box">
				<p class="phonetc_bt">友情提醒:</p>
				<p class="wz">您还未绑定手机号，请您在下方输入框中输入您的手机号码完成绑定。</p>
				<p><input type="text" name="mobile" id="mobile" placeholder="请输入您的手机号码"></p>
				<p class="clearfix">
					<input type="text" id="yzm" name="yzm" placeholder="" class="yzm_input" />
					<span class="yzm_btn" id="send_code">获取验证码</span>
				</p>
				<p><button type="button" id="btn" class="phone_btn">确认</button></p>
			</div>
			</form>
		</div>
	</body>
		<?php if($browder_type!=1): ?>
		<nav class="bottom">
			<div class="navbox">
				<a class=" <?php if($action=='index'&&$controller=='Index'): ?>mui-active<?php endif; ?>" href="<?php echo url('index/index'); ?>">
					<span class="iconfont icon-51"></span><br>
					<span class="mui-tab-label">附近商家</span>
				</a>
				<a class="right <?php if($action=='index'&&$controller=='Member'): ?>mui-active<?php endif; ?>" href="<?php echo url('member/index'); ?>">
					<span class="iconfont icon-gerenzhongxin"></span><br>
					<span class="mui-tab-label">个人中心</span>
				</a>
			</div>
		</nav>
<?php endif; ?>

</html> 
<script src="__PUBLIC__/static/js/jquery.min.js"></script>
<link rel="stylesheet" href="__PUBLIC__/static/layui/css/layui.css">
<script src="__PUBLIC__/static/layui/layui.all.js"></script>
<script>
var index = layer.load(1, {shade: false,time: 1.5 * 1000});
$(".layui-layer-loading").css("left", "50%");
</script>
<script>
    $(function(){ 
    	//用户注册
	    var mobile = "<?php echo $info_user['mobile']; ?>";   
	    if(mobile.length == 11){
	    	$('#bind_phone').hide();
	    } 
    });

		//个人资料
	$(".mem_infobox").click(function(){
	 parent.location.href="<?php echo url('member/member'); ?>"
	});
	//余额
	$("#yu").click(function(){
	 parent.location.href="<?php echo url('member/yue_record'); ?>"
	});
	//鼓励金
	$("#jf").click(function(){
	 parent.location.href="<?php echo url('member/glj'); ?>"
	}); 
	
	fx = $('#fx').val();
	$("#tui").click(function(){
	    if(fx == 1){
	    	 parent.location.href="<?php echo url('member/friends'); ?>";
	    }else{
	    	parent.location.href="<?php echo url('member/yaoq'); ?>";
	    }
    }); 
    
    
    var onoff = true;
	//获取验证码
	$('#send_code').click(function() {
		//false就不能发送
		if(!onoff) {
			return;
		}
		onoff = false;
		//点击玩按钮干什么?
		//发验证码? 
		// 1-给谁发? 手机号码
		var phone = $("#mobile").val();
		
		if(phone == '') {
			layer.msg('手机号码不能为空');
			onoff = true;
			return;
		}
		var reg = /^1[3|4|5|6|7|8|9][0-9]{9}$/; //验证规则
		if(!reg.test(phone)) {
			layer.msg('手机号码格式不正确');
			onoff = true;
			return;
		}
		$.ajax({
			type:"post",
			//请求的url
			//注意，如果我们使用路由器的情况下，我们需要设置一下本地服务器的ip地址
			url: "<?php echo url('index/index/verify_code'); ?>",
			//请求的过程中传递过去的参数 json
			data: {
				mobile: phone,
			},
			//成功了的回调，并且带有返回值
			success: function(data) {
				layer.msg(data.msg);
				var num = 60;
				var timer = setInterval(function() {
					num--;
					if(num == 0) {
						$('#send_code').text('发送验证码');
						//定时器停了
						clearInterval(timer);
						onoff = true;
					} else {
						$('#send_code').text(num + 'S');
					}
				}, 1000); // 1000 毫秒==1秒
			}
		})
	});
	
	 
	//提交请求
	$('#btn').click(function() {
		var phone = $("#mobile").val();
		var input_code = $("#yzm").val(); 
		
		if(phone == '') {
			layer.msg('手机号码不能为空');
			return;
		}
		var reg = /^1[3|4|5|6|7|8|9][0-9]{9}$/; //验证规则
		if(!reg.test(phone)) {
			layer.msg('手机号码格式不正确');
			onoff = true;
			return;
		}
		if(input_code.trim() == '') {
			layer.msg('验证码不能为空');
			return;
		} 
		btn.disabled = true;
		setTimeout(function() {
			btn.disabled = false;
		}, 1500);
		//写入数据库
		$.ajax({
			type:"post",
			//请求的url
			//注意，如果我们使用路由器的情况下，我们需要设置一下本地服务器的ip地址
			url: "<?php echo url('index/member/userzc'); ?>",
			//请求的过程中传递过去的参数 json
			data: {
				mobile: phone,
				yzm:input_code
			}, 
			success: function(data) { 
				if(data.code == 200) {
					layer.msg(data.msg, {
							icon: 1,
							time: 2000
						},
						function() {
							window.location.href = "index";
						});
				} else {
					layer.msg(data.msg, {
						icon: 1,
						time: 2000
					});
				}
			}
 
		})
	});
</script>   
